webpackJsonp([15],{

/***/ "DxgV":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/apps/analysis/law-doc.gql
var law_doc = __webpack_require__("hv/w");
var law_doc_default = /*#__PURE__*/__webpack_require__.n(law_doc);

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./node_modules/_lodash@4.17.11@lodash/lodash.js
var lodash = __webpack_require__("psq8");
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);

// EXTERNAL MODULE: ./node_modules/_echarts@3.8.5@echarts/lib/echarts.js
var echarts = __webpack_require__("+Ky8");
var echarts_default = /*#__PURE__*/__webpack_require__.n(echarts);

// EXTERNAL MODULE: ./node_modules/_echarts@3.8.5@echarts/theme/macarons.js
var macarons = __webpack_require__("TW58");
var macarons_default = /*#__PURE__*/__webpack_require__.n(macarons);

// EXTERNAL MODULE: ./node_modules/_echarts@3.8.5@echarts/lib/chart/line.js
var line = __webpack_require__("feM/");
var line_default = /*#__PURE__*/__webpack_require__.n(line);

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/apps/analysis/law-doc.vue


//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//








var COLORS = ['#3d74f1', '#fe413b', '#7a86ff', '#fab63f', '#55acee', '#4c70ba'];
var DOCUMENTS = [{
  code: 'D0001',
  text: '现场检查方案'
}, {
  code: 'D0002',
  text: '现场检查文书'
}, {
  code: 'D0003',
  text: '责令限期整改指令书'
}, {
  code: 'D0004',
  text: '整改复查意见书'
}, {
  code: 'D0005',
  text: '现场处理措施决定书'
}, {
  code: 'D0006',
  text: '查封扣押决定书'
}];
var MONTHS = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];

/* harmony default export */ var analysis_law_doc = ({
  data: function data() {
    var _this = this;

    return {
      DOCUMENTS: DOCUMENTS,
      COLORS: COLORS,
      search: false,
      selected: [],
      entList: [],
      rightData: [{
        font: 'yt-icon yt-icon-search',
        click: function click() {
          _this.search = !_this.search;
        }
      }],
      total: {},
      chartObj: {},
      chartOption: {
        color: COLORS,
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          show: false,
          data: [],
          align: 'right'
        },
        grid: {
          right: '12%'
        },
        xAxis: [{
          name: '月份',
          nameLocation: 'end',
          boundaryGap: false, // 坐标轴两端空白策略
          type: 'category',
          data: MONTHS,
          axisTick: {
            alignWithLabel: true
          }
        }],
        yAxis: [{
          name: '隐患/个数',
          type: 'value'
        }],
        series: []
      }
    };
  },

  computed: {
    currentTotal: function currentTotal() {
      if (this.total['1'] === 'N/A' || this.total['2'] === 'N/A') {
        return 'N/A';
      }
      var total = this.total['1'] + this.total['2'];
      return isNaN(total) ? 0 : total;
    }
  },
  methods: {
    getDocumentName: function getDocumentName(code) {
      var obj = DOCUMENTS.find(function (v) {
        return v.code === code;
      });
      return obj ? obj.text : '';
    },
    renderTotal: function renderTotal(record) {
      record = lodash_default.a.zipObject(record.keys, record.values);
      this.total = record;
    },
    renderCard: function renderCard(month) {
      var obj = lodash_default.a.zipObject(month.keys, month.values);
      var series = DOCUMENTS.map(function (item) {
        var data = [];
        var val = obj[item.code];
        if (val) data = MONTHS.map(function (v, index) {
          return val[index + 1] || 0;
        });
        return {
          name: item.text,
          type: 'bar',
          data: data
        };
      });
      this.chartOption.series = series;
      this.chartObj.setOption(this.chartOption);
    },
    onSearch: function onSearch(id) {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var _ref, record, month;

        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _this2.search = false;
                _this2.currentId = id;
                _context.next = 4;
                return commonApi["a" /* commonApi */].gql(law_doc_default.a, {
                  'qjson': id ? { equalTo: ['ent_id', id] } : {}
                });

              case 4:
                _ref = _context.sent;
                record = _ref.record;
                month = _ref.month;

                _this2.renderTotal(record);
                _this2.renderCard(month);

              case 9:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this2);
      }))();
    },
    onInit: function onInit() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.next = 2;
                return commonApi["a" /* commonApi */].search('ent_enterprise');

              case 2:
                _this3.entList = _context2.sent;

                _this3.chartOption.legend.data = DOCUMENTS.map(function (item) {
                  return item.text;
                });
                _this3.onSearch();

              case 5:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this3);
      }))();
    },
    getBgC: function getBgC(idx) {
      return 'background-color:' + COLORS[idx];
    }
  },
  activated: function activated() {
    this.chartObj = echarts_default.a.init(this.$refs.chart, 'macarons');
    this.onInit();
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-0cf11a06","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/apps/analysis/law-doc.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"执法文书统计","scroll":"","rightData":_vm.rightData}},[_c('yt-card',{attrs:{"title":"概览"}},_vm._l((_vm.DOCUMENTS),function(item,index){return _c('yt-cell',{key:index,attrs:{"label":item.text,"labelWidth":"200px","value":("共计 " + (_vm.total[item.code] || 0) + " 条记录")}},[_c('div',{staticClass:"flex",attrs:{"slot":"label"},slot:"label"},[_c('div',{staticClass:"lengent",style:(_vm.getBgC(index))}),_vm._v(" "),_c('span',[_vm._v(_vm._s(item.text))])])])}),1),_vm._v(" "),_c('yt-card',{attrs:{"title":"执法文书统计数据"}},[_c('div',{ref:"chart",staticClass:"chart",staticStyle:{"width":"100%","height":"400px"}})]),_vm._v(" "),_c('yt-popup',{attrs:{"slot":"alert","pos":"right","mask":true},slot:"alert",model:{value:(_vm.search),callback:function ($$v) {_vm.search=$$v},expression:"search"}},[_c('yt-page',{staticClass:"page",attrs:{"flex":true,"leftData":[],"title":"企业列表"}},[_c('yt-form',{staticStyle:{"background-color":"#fff"}},[_c('yt-radioList',{staticClass:"list",attrs:{"list":_vm.entList,"label":"EnterpriseName","val":"id","inline":false},model:{value:(_vm.selected),callback:function ($$v) {_vm.selected=$$v},expression:"selected"}}),_vm._v(" "),_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white"},on:{"click":function($event){_vm.search = false}}},[_vm._v("关闭")]),_vm._v(" "),_c('yt-btn',{on:{"click":function($event){return _vm.onSearch(_vm.selected)}}},[_vm._v("确定")])],1)],1)],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var apps_analysis_law_doc = (esExports);
// CONCATENATED MODULE: ./src/apps/analysis/law-doc.vue
function injectStyle (ssrContext) {
  __webpack_require__("cDrb")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-0cf11a06"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  analysis_law_doc,
  apps_analysis_law_doc,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var src_apps_analysis_law_doc = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "cDrb":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "hv/w":
/***/ (function(module, exports) {

module.exports = "query fetch($qjson: JSON) {\n  record: law_office_recordAggregate(qjson: $qjson) @_(get: \"groupedBy.record_type\") {\n    groupedBy {\n      record_type {\n        keys\n        values @_(map: \"count\") {\n          count\n        }\n      }\n    }\n  }\n  month: law_office_recordAggregate(qjson: $qjson) @_(get: \"groupedBy.record_type\") {\n    groupedBy {\n      record_type {\n        keys\n        values @_(map: \"values\") {\n          count\n          values @_(groupBy: \"checked_time\", mapValues: \"length\") {\n            checked_time @_(moment: \"M\")\n          }\n        }\n      }\n    }\n  }\n}\n"

/***/ })

});